//===================================================================================
// $$
//
// Coder: Code Milker v1.0
// 0 - upper
// 1 - lower
//===================================================================================


namespace App.Domain.Handlers {
    using System;
    using App.Data;
    using App.Domain.Contracts;

    public class DeleteApplication {
        private readonly IApplicationRepository _ApplicationRepository;

        public DeleteApplication(IApplicationRepository ApplicationRepository) {
            _ApplicationRepository = ApplicationRepository;
        }

        public virtual void Execute(Guid applicationId) {
            var ApplicationToDelete = _ApplicationRepository.GetApplication(applicationId);

            if (ApplicationToDelete != null) {
                _ApplicationRepository.Delete(applicationId);
            }
            else {
                throw new BusinessServicesException("UnableToDeleteVehicleExceptionMessage");
            }
        }
    }
}
